package org.smth.search.indexer.impl;

import org.apache.lucene.analysis.TokenStream;
import org.smth.search.config.IndexerConfig;
import org.smth.search.indexer.IndexAnalyzer;

import java.io.Reader;

import com.google.inject.Singleton;
import com.google.inject.Inject;

@Singleton
public class EnumAllAnalyzer extends IndexAnalyzer {

	@Inject
	private IndexerConfig config;

	public TokenStream tokenStream(String field, Reader reader) {
		if ("flag".equals(field)) {
			return new FlagTokenStream(reader);
		} else {
			return new EnumAllTokenStream(reader, config.getMinCHWordLen(), config.getMaxCHWordLen(), config.getMinENWordLen(), config.getMaxENWordLen());
		}
	}

}
